package com.derekandbritt.booST.data;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

@Deprecated
public class DatabaseHelper extends SQLiteOpenHelper {

    private static final String TAG = "DatabaseHelper";

    private static final String DATABASE_NAME = "booST.db";
    private static final int DATABASE_VERSION = 1;
    
    private static final String ENERGY_TABLE_NAME = "energy";
    private static final String ENERGY_COLUMN_ID = "id";
    private static final String ENERGY_COLUMN_LEVEL = "energy_level";
    private static final String ENERGY_COLUMN_TIMESTAMP = "timestamp";
    
    DatabaseHelper(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL("CREATE TABLE " + ENERGY_TABLE_NAME + " ("
                + ENERGY_COLUMN_ID + " INTEGER PRIMARY KEY,"
                + ENERGY_COLUMN_LEVEL + " INTEGER,"
                + ENERGY_COLUMN_TIMESTAMP + " INTEGER"
                + ");");
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        Log.w(TAG, "Upgrading database from version " + oldVersion + " to " + newVersion + ", which will destroy all old data");
        db.execSQL("DROP TABLE IF EXISTS " + ENERGY_TABLE_NAME);
        onCreate(db);
    }
    
    public EnergyLevel getCurrentEnergyLevel() {
    	this.getReadableDatabase();
    	return null;
    }
}